﻿using System;
using System.Collections;
using System.Collections.Generic;
using Framework.Timer;
using UnityEngine;

public class LightAnim : MonoBehaviour
{

    public float MaxValue;

    public float Time;
    
    public Light Light;

    private TimeHandler _handler;
    
    public void OnEnable()
    {
        this._handler?.Kill();
        this._handler = GameUpdateMgr.Instance.CreateTimer(this.Time, () => { this.Light.intensity = this.MaxValue; },
                                                           f => { this.Light.intensity = f * this.MaxValue; });
    }

    private void OnDisable()
    {
        this._handler?.Kill();
    }

}
